#include "MainFrame/MenuBar/ColorsMenuList.h"
#include <QEvent>

#include "MainFrame/MenuBar/Dialogs/BrightnessContrastDialog.h"

ColorsMenuList::ColorsMenuList(const QString &title, QWidget *parent) :
    MenuListBase(title, parent),
    m_pcolorBalanceAction(nullptr),
    m_phueSaturationAction(nullptr),
    m_pcolorizeAction(nullptr),
    m_pbrightnessContrastAction(nullptr),
    m_pthresholdAction(nullptr),
    m_plevelsAction(nullptr),
    m_pcurvesAction(nullptr),
    m_pposterizeAction(nullptr),
    m_pdesaturateAction(nullptr)
{
    m_pcolorBalanceAction = addOneAction("Color Balance", this);
    m_phueSaturationAction = addOneAction("Hue-Saturation", this);
    m_pcolorizeAction = addOneAction("Colorize", this);
    m_pbrightnessContrastAction = addOneAction("Brightness-Contrast", this);
    m_pthresholdAction = addOneAction("Threshold", this);
    m_plevelsAction = addOneAction("Levels", this);
    m_pcurvesAction = addOneAction("Curves", this);
    m_pposterizeAction = addOneAction("Posterize", this);
    m_pdesaturateAction = addOneAction("Desaturate", this);

    connect(m_pcolorBalanceAction, SIGNAL(triggered()), this, SLOT(colorBalanceSlot()));
    connect(m_phueSaturationAction, SIGNAL(triggered()), this, SLOT(hueSaturationSlot()));
    connect(m_pcolorizeAction, SIGNAL(triggered()), this, SLOT(colorizeSlot()));
    connect(m_pbrightnessContrastAction, SIGNAL(triggered()), this, SLOT(brightnessContrastSlot()));
    connect(m_pthresholdAction, SIGNAL(triggered()), this, SLOT(thresholdSlot()));
    connect(m_plevelsAction, SIGNAL(triggered()), this, SLOT(levelsSlot()));
    connect(m_pcurvesAction, SIGNAL(triggered()), this, SLOT(curvesSlot()));
    connect(m_pposterizeAction, SIGNAL(triggered()), this, SLOT(posterizeSlot()));
    connect(m_pdesaturateAction, SIGNAL(triggered()), this, SLOT(desaturateSlot()));
}

ColorsMenuList::~ColorsMenuList()
{

}

void ColorsMenuList::changeEvent(QEvent *event)
{
    QWidget::changeEvent(event);
    switch (event->type())
    {
    case QEvent::LanguageChange:
        initTrans();
        break;
    default:
        break;
    }
}

void ColorsMenuList::initTrans()
{
    m_pcolorBalanceAction->setText(tr("Color Balance"));
    m_phueSaturationAction->setText(tr("Hue-Saturation"));
    m_pcolorizeAction->setText(tr("Colorize"));
    m_pbrightnessContrastAction->setText(tr("Brightness-Contrast"));
    m_pthresholdAction->setText(tr("Threshold"));
    m_plevelsAction->setText(tr("Levels"));
    m_pcurvesAction->setText(tr("Curves"));
    m_pposterizeAction->setText(tr("Posterize"));
    m_pdesaturateAction->setText(tr("Desaturate"));
}

void ColorsMenuList::colorBalanceSlot()
{

}

void ColorsMenuList::hueSaturationSlot()
{

}

void ColorsMenuList::colorizeSlot()
{

}

void ColorsMenuList::brightnessContrastSlot()
{
    BrightnessContrastDialog* dialog = new BrightnessContrastDialog(this);
    dialog->setMinimumWidth(300);
    dialog->show();
}

void ColorsMenuList::thresholdSlot()
{

}

void ColorsMenuList::levelsSlot()
{

}

void ColorsMenuList::curvesSlot()
{

}

void ColorsMenuList::posterizeSlot()
{

}

void ColorsMenuList::desaturateSlot()
{

}
